package com.ruoyi.api.worker;

import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.system.domain.JiajiaWorkerTimeConfig;
import com.ruoyi.system.domain.JiajiaWorkerTimeXxConfig;
import com.ruoyi.system.service.IJiajiaWorkerTimeConfigService;
import com.ruoyi.system.service.IJiajiaWorkerTimeXxConfigService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * 社工休息时间配置Controller
 * 
 * @author 郑鑫
 * @date 2024-04-24
 */
@RestController
@RequestMapping("/api/timeXxConfig")
public class ApiWorkerTimeXxConfigController extends BaseController
{

    @Autowired
    private IJiajiaWorkerTimeXxConfigService jiajiaWorkerTimeXxConfigService;

    @Autowired
    private IJiajiaWorkerTimeConfigService jiajiaWorkerTimeConfigService;

    /**
     * 查询社工接单时间配置列表
     */
    @PostMapping("/time/list")
    @ResponseBody
    public TableDataInfo list(JiajiaWorkerTimeConfig jiajiaWorkerTimeConfig)
    {
        startPage();
        List<JiajiaWorkerTimeConfig> list = jiajiaWorkerTimeConfigService.selectJiajiaWorkerTimeConfigList(jiajiaWorkerTimeConfig);
        return getDataTable(list);
    }

    /**
     * 查询社工休息时间配置列表
     */
    @PostMapping("/rest/time/list")
    @ResponseBody
    public TableDataInfo list(JiajiaWorkerTimeXxConfig jiajiaWorkerTimeXxConfig)
    {
        startPage();
        List<JiajiaWorkerTimeXxConfig> list = jiajiaWorkerTimeXxConfigService.selectJiajiaWorkerTimeXxConfigList(jiajiaWorkerTimeXxConfig);
        return getDataTable(list);
    }

    /**
     * 新增保存社工休息时间配置
     */
    @Log(title = "社工休息时间配置", businessType = BusinessType.INSERT)
    @PostMapping("/add")
    @ResponseBody
    public AjaxResult addSave(JiajiaWorkerTimeXxConfig jiajiaWorkerTimeXxConfig)
    {
        return toAjax(jiajiaWorkerTimeXxConfigService.insertJiajiaWorkerTimeXxConfig(jiajiaWorkerTimeXxConfig));
    }

    /**
     * 修改保存社工休息时间配置
     */
    @Log(title = "社工休息时间配置", businessType = BusinessType.UPDATE)
    @PostMapping("/edit")
    @ResponseBody
    public AjaxResult editSave(JiajiaWorkerTimeXxConfig jiajiaWorkerTimeXxConfig)
    {
        return toAjax(jiajiaWorkerTimeXxConfigService.updateJiajiaWorkerTimeXxConfig(jiajiaWorkerTimeXxConfig));
    }

    /**
     * 删除社工休息时间配置
     */
    @Log(title = "社工休息时间配置", businessType = BusinessType.DELETE)
    @PostMapping( "/remove")
    @ResponseBody
    public AjaxResult remove(String ids)
    {
        return toAjax(jiajiaWorkerTimeXxConfigService.deleteJiajiaWorkerTimeXxConfigByIds(ids));
    }

    /**
     * 查询社工接单时间配置列表
     */
    @PostMapping("/configList")
    @ResponseBody
    public TableDataInfo configList(JiajiaWorkerTimeConfig jiajiaWorkerTimeConfig)
    {
        startPage();
        List<JiajiaWorkerTimeConfig> list = jiajiaWorkerTimeConfigService.selectJiajiaWorkerTimeConfigList(jiajiaWorkerTimeConfig);
        return getDataTable(list);
    }



}
